
<script type="text/template" id="minicart_item_tpl">
    <li class="clearfix shopcart-goods-li">
        <div class="shopcart-goods-image">
            <img src="{image_url}" alt="">
        </div>
        <div class="shopcart-goods-name">
            <p>{name}<br>{spec_info}</p>
        </div>
        <div class="shopcart-goods-price">
            <div class="goods-handle">
                <span class="goods-price">￥{buy_price}</span>
            </div>
            <div class="delate-goods">
                <a href="{remove_url}" class="delate-goods cart-remove">删除</a>
            </div>
        </div>
    </li>
</script>
<script charset="utf-8">
    $(function(){
        /**
         * 模板填充工具
         */
        var substitute = function(str, obj) {
            return str.replace(/\\?\{([^{}]+)\}/g, function(match, name) {
                if (match.charAt(0) == '\\') return match.slice(1);
                return (obj[name] != undefined) ? obj[name] : '';
            });
        };
        /**
         * 登录\注册切换
         */
        if($.cookie('UNAME') && $.cookie('MEMBER_IDENT')){
            $('.top-tools .is-unlogin').addClass('hidden');
            $('.top-tools .is-login').removeClass('hidden');
            $('.top-tools .is-login .uname').text($.cookie('UNAME'));
            if('6' == $.cookie('MEMBER_LEVEL_ID')){
                $('.top-tools .zter').removeClass('hidden');
            }
        }
        /**
         * 迷你购物车
         */
            //购物车数量加载
        var cart_count=null;
        var cart_count_get=false;
        $.get('https://www.myzte.com/index.php/openapi/cart/count')
            .done(function(re){
                if(re.data&&re.data.count>0){
                    $('.cart-count').removeClass('hidden').text(re.data.count);
                    cart_count=re.data.count;
                    $('.shop-cart').find('.shopcart-null').remove();
                }else{
                    $('.shop-cart').find('.shopcart-full').remove();
                }
            })
            .fail(function(){
                $('.shop-cart').find('.shopcart-full').remove();
            })
            .always(function(){
                cart_count_get=true;
            })
        //购物车项
        var cart_load_twice=0;
        $('.shop-cart').on('mouseenter',function(e){
            if(cart_count_get){
                if(cart_count){
                    if(cart_load_twice===0){
                        cart_load_twice=1;
                        $.ajax({
                            url:'https://www.myzte.com/index.php/openapi/cart/preview',
                            dataType:'json'
                        })
                            .done(function(re){
                                if(re.data && re.data.length){
                                    var item_html ='',item_html_tpl = $('#minicart_item_tpl').html();
                                    $.each(re.data,function(idx,item){
                                        item_html+=substitute(item_html_tpl,item);
                                    });
                                    $('.shopcart-full').show().find('ul').html(item_html);
                                    $('.shop-cart').find('.shopcart-logo').addClass('active');
                                }
                            });
                    }else{
                        $(this).find('.shopcart-logo').addClass('active');
                        $('.cart-content').show();
                    }
                }else{
                    $(this).find('.shopcart-logo').addClass('active');
                    $('.cart-content').show();
                }
            }
        });
        $('.shop-cart').on('mouseleave',function(){
            $('.cart-content').hide();
            $(this).find('.shopcart-logo').removeClass('active');
        });
        //购物车快速删除
        $('.shop-cart').on('click','.cart-remove',function(e){
            var cr_btn = $(this);
            $.get(cr_btn.attr('href'));
            cr_btn.parents('.shopcart-goods-li').remove();
            if($('.shop-cart').find('.shopcart-full ul li.shopcart-goods-li').length===0){
                $('.shop-cart').find('.shopcart-full').remove();
            }
            return false;
        });
    });
</script>

<script type="text/javascript">
    $(document).ready(function(){
        $('.all-categories').add('.all-categories-detail').on({
            mouseover:function(){
                $('.all-categories-detail').show();
            },
            mouseout:function(){
                $('.all-categories-detail').hide();
            }
        });
        $('.fenlei-two li:nth-child(6n+1)').find('.goods-img').css('border-left','none');
    });
</script>
<script>
    $(function(){
        $(".is-login").hover(function() {
            $(".dropdown-menu").css('display', 'inline-block');
        }, function() {
            $(".dropdown-menu").css('display', 'none');
        });
    })
    //获取地址栏参数
    $(function(){
        var urlParam= decodeURIComponent(window.location.search);
        //alert(urlParam);
        if (urlParam.indexOf('?keyword=') != -1) {

            if (urlParam.indexOf('&') == -1) {
                var loc = urlParam.substring(urlParam.indexOf('=') + 1);

            }else{
                var end = urlParam.indexOf('&');
                var loc = urlParam.substring(urlParam.indexOf('=') + 1, end);
            }
            if (loc != '') {
                $(".fast-search").addClass('hide');
                $("#input_keyword").val(loc);
            }else{
                $(".fast-search").removeClass('hide');
            }
        };
    })
</script>
<script>
    (function(){
        $.getJSON("https://www.myzte.com/index.php/openapi/content_node/articles/node_id/35",'',function(re){
            if(re.result=='success' && re.data.length>0){
                var length = re.data.length > 3?3:re.data.length;
                var html = '';
                for(var i=0;i < length;i++){
                    html+= '<li><a href="'+re.data[i].link+'">'+re.data[i].title+'</a></li>';
                }
                $('#newsBox ul').html(html);
            }
        });
        /*新闻向上无缝滚动*/
        var area = document.getElementById('newsBox');
        var liHeight = 24; //单行滚动高度
        var speed = 50; //滚动速度
        var time;
        var delay = 2000; //滚动间隔时间
        area.scrollTop = 0;
        area.innerHTML += area.innerHTML; //新闻列表克隆
        function scrollUp(){
            if (area.scrollTop % liHeight == 0) {
                clearInterval(time);
                setTimeout(startScroll,delay);
            }else{
                area.scrollTop++;
                if (area.scrollTop >= area.scrollHeight/2) {
                    /*当第一个ul向上滚动到滚动区域顶端,重置为0*/
                    area.scrollTop = 0;
                };
            }
        }
        function startScroll(){
            time = setInterval(scrollUp,speed);
            area.scrollTop++;
        }
        setTimeout(startScroll,delay);
    })();
</script>
<div class="container main-container">
    <div class="jumbotron blank-cart row">
        <div class="col-xs-5 cart-img">
            <img src="__PUBLIC__/template/images/blankcart.png">
        </div>
        <div class="col-xs-3 cart-text">
            <h3>购物车是空的！</h3>
            <p>请快挑选喜欢的商品吧</p>
        </div>
        <div class="col-xs-4 cart-btn">
            <p><a class="btn btn-primary btn-lg" href="https://www.myzte.com/list.html" role="button">立即去购物</a></p>
        </div>
    </div>
    <script type="text/javascript">
        $(document.body).addClass('blankcart-body');
    </script>


</div>
<style>
    /* CSS Document */
    .toolbar-item,.toolbar-layer{background:url(//res.myzte.com/31/78/7b117df5d52d.png?vd855) no-repeat;}
    .toolbar{ z-index:9999;position:fixed;right:0px;bottom:50px;}/*假设网页宽度为1200px，导航条在右侧悬浮*/
    .toolbar-item{display:block;width:52px;height:52px;margin-top:1px;position:relative;-moz-transition:background-position 1s;-ms-transition:background-position 1s;-o-moz-transition:background-position 1s;-webkit-moz-transition:background-position 1s;transition:background-position 1s;}
    .toolbar-item:hover .toolbar-layer{opacity:1;filter:alpha(opacity=100);transform:scale(1);-webkit-transform:scale(1);-moz-transform:scale(1);-ms-transform:scale(1);-o-transform:scale(1);}
    .toolbar-item-weixin{background-position:0 -798px;}
    .toolbar-item-weixin:hover{background-position:0 -860px;}
    .toolbar-item-weixin .toolbar-layer{height:194px;background-position:0 -222px;}
    .toolbar-item-feedback{background-position:0 -426px;}
    .toolbar-item-feedback:hover{background-position:0 -488px;}
    .toolbar-item-feedback .toolbar-layer{height:194px;background-position:0 -10px;}
    .toolbar-item-app{background-position:0 -550px;}
    .toolbar-item-app:hover{background-position:0 -860px;}
    .toolbar-item-app .toolbar-layer{height:194px;background-position:0 -222px;}
    .toolbar-item-top{background-position:0 -674px;}
    .toolbar-item-top:hover{background-position:0 -736px;}
    .toolbar-layer{position:absolute;right:46px;bottom:-10px;width:172px;opacity:0;filter:alpha(opacity=0);
        transform-origin: 95% 95%;-moz-transform-origin: 95% 95%;-ms-transform-origin: 95% 95%;-o-transform-origin: 95% 95%;-webkit-transform-origin: 95% 95%;transform:scale(0.01);
        -moz-transform:scale(0.01);-ms-transform:scale(0.01);-o-transform:scale(0.01);-webkit-transform:scale(0.01);transition:all 1s;-moz-transition:all 1s;-ms-transition:all 1s;-o-transition:all 1s;-webkit-transition:all 1s;}

</style>
<div class="toolbar">
    <a href="https://www.myzte.com/cart-blank.html###" class="toolbar-item toolbar-item-weixin">

        <span class="toolbar-layer"></span>
    </a>
    <a href="http://v1.live800.com/live800/chatClient/chatbox.jsp?companyID=437521&amp;configID=41175&amp;jid=9108176411" class="toolbar-item toolbar-item-feedback" target="_Blank">
        <span class="toolbar-layer"></span>
    </a>

    <a href="javascript:scroll(0,0)" id="top" class="toolbar-item toolbar-item-top"></a>
</div>




<script>
    $(".pagination").addClass('clearfix');
    $(".prev").children('a').html('<img src="../themes/pc/zhongxing/images/left_1.png?vea39" alt="">');
    $(".next").children('a').html('<img src="../themes/pc/zhongxing/images/right_1.png?vea39" alt="">');
</script>
<script charset="utf-8">
    //底部帮助中心openAPI
    var help = "https://www.myzte.com/index.php/openapi/content_help/foot/";
    $.getJSON(help,{node_id:'1'},function(recv){
        if(recv.result=='success' && recv.data){
            var i = 0;
            var html = '';
            var li = '';
            $('.help-center').children('.list-unstyled').each(function(){
                if(recv.data[i]){
                    for(var j= 0; j<recv.data[i].article_list.length;j++){
                        li += '<li><a href="'+recv.data[i].article_list[j].link+'">'+recv.data[i].article_list[j].title+'</a></li>';
                    }
                    html += '<li class="help-title"><a href="javascript:;">'+recv.data[i].node_name+'</a></li><li class="help-list"><ul>' + li +'</ul>';
                    li = '';
                    $(this).html(html);
                    html = '';
                    i++;
                }
            });
        }
    });
</script>
<script>
    var _hmt = _hmt || [];
    (function() {
        var hm = document.createElement("script");
        hm.src = "//hm.baidu.com/hm.js?2460548f7273e134eeec7ceec2087037";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>

<!--site footer common-->
<script charset="utf-8">
    /*购物数量 事件拦截开始*/

    $(function(){
        var change_event_timer = 0;
        var _change_quantity = function(ipt,num){
            ipt = $(ipt),last_val = parseInt(ipt.val());
            var set_v = last_val+num;
            ipt.val(set_v);
            if(isNaN(ipt.val()) || ipt.val()<1){
                ipt.val('1');
            }
            if(ipt.attr('data-max') && set_v>parseInt(ipt.attr('data-max'))){
                ipt.val(ipt.attr('data-max'));
            }
            if(ipt.attr('data-min') && set_v<parseInt(ipt.attr('data-min'))){
                ipt.val(ipt.attr('data-min'));
            }
            if(set_v === parseInt($(ipt).attr('data-now')))return;
            $(ipt).attr('data-now',set_v);
            ipt.trigger('_change',[ipt.val(),num]);
        }

        $('.product-quantity .spinner-buttons').on('click',function(e){
            var btn = $(this);
            btn.find('button').eq(0).blur();
            if(btn.data('animating'))return;
            if(btn.next('.spinner-input').length){
                _change_quantity(btn.next('.spinner-input'),-1);
            }
            if(btn.prev('.spinner-input').length){
                _change_quantity(btn.prev('.spinner-input'),+1);
            }
            btn.data('animating',true);
            btn.css('opacity',.2);
            btn.animate({opacity:1},'slow',function(){
                $(this).removeData('animating');
            });


        });
        $('.product-quantity .spinner-input').on('keyup',function(e){
            switch (e.keyCode) {
                case 38:
                    _change_quantity(this,+1);
                    break;
                case 40:
                    _change_quantity(this,-1);
                    break;
                default:
                    _change_quantity(this,0);
            }
        });
    });

    /*购物数量 事件拦截结束*/
</script>
<div style="display:none" data-rel="Baidu Analytics"><script>
    var _hmt = _hmt || [];
    (function() {
        var hm = document.createElement("script");
        hm.src = "//hm.baidu.com/hm.js?2460548f7273e134eeec7ceec2087037";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script></div>
<script>
    var arr=location.href.split("#");
    var nums = arr.length;
    if(nums>1){
        var reg = /^[A-Z0-9a-z]+$/;
        for(var i = 1 ;i<nums ;i++){
            var arg = arr[i].split("=");
            if(arg[0] =='cmscode' && reg.test(arg[1])){
                $.cookie('cmscode', arg[1] ,{path:'/'});
                break;
            }
        }
    }
</script>
<script>
    var arr=location.href.split("#");
    var nums = arr.length;
    if(nums>1){
        var reg = /^[1-9][0-9]*$/;
        for(var i = 1 ;i<nums ;i++){
            var arg = arr[i].split("=");
            if(arg[0] =='fmid' && reg.test(arg[1])){
                $.cookie('fmid', arg[1] ,{path:'/'});
                break;
            }
        }
    }
</script>
